{include file="public:header"/}

{include file="public:sidemenu"/}
		<!-- Start right Content here -->
		<div class="content-page">
			<!-- Start content -->
			<div class="content">
				<div class="am-g">

         <!--  <div>
  <ul class="am-nav am-navbar-nav am-navbar">
    <li class="hidden-xs am-hide-sm-only">
      <form action="{:url('search')}" method="post" role="search" class="app-search">
        <input type="text" placeholder="Search..." class="form-control" name="key">
        <button type="submit" class="btn btn-default"><i class="fa fa-search" aria-hidden="true"></i>搜索</button>
      </form>
    </li>
  </ul>
</div> -->


<button><a href="{:url('jiekou')}">查看</a></button>

					<span>
						<button type="button" class="btn btn-default" data-toggle="modal" data-target="#addmodal" style="float: right;margin-right: 100px;color: #1E90FF">
						<i class="fa fa-plus fa-2x" aria-hidden="true" >添加</i>
						</button>
          </span> 

					
						
        <div class="am-u-sm-12">
              <table id="clubs" class="am-table am-table-striped am-table-hover table-main">
                <thead>
                  <tr>
                  	<th>编号</th>
                    <th>俱乐部名称</th>
                    <th>简介</th>
                    <th>俱乐部地点</th>
                    <th>联系电话</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                {volist name="clubs" id="vo"}
                  <tr>
                  	<td>{$vo.c_id}</td>
                    <td>{$vo.c_name}</td>
                    <td>{$vo.c_intro}</td>
                    <td>{$vo.c_address}</td>
                    <td>{$vo.c_tel}</td>
                    <td>
                      <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                          <a href="#" data-toggle="modal" data-target="#editmodal" onclick="jsedit({$vo.c_id})">修改</a>
                          |
                          <a href="{:url('delete',['id'=>$vo.c_id])}">删除</a>
                        </div>
                      </div>

                    </td>
                  </tr>
                  {/volist}
                </tbody>
              </table>
            </div> 


<!-- 添加模态框 -->
    <div id="addmodal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-header">
        <h3 id="myModalLabel">添加俱乐部</h3>
      </div>
      <div class="modal-body">
        <p>
        <form class="am-form am-text-sm" method="post" action="{:url('add')}" enctype="multipart/form-data">

  <div class="form-group">
    <label  class="col-sm-2 am-form-label" for="c_name" >俱乐部名称</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="c_name" placeholder="俱乐部名称" name="c_name" required>
    </div>
  </div>

  <div class="form-group">
    <label  class="col-sm-2 am-form-label" for="c_tel" >联系电话</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="c_tel" placeholder="联系电话" name="c_tel" required>
    </div>
  </div>

<div class="form-group">
    <label  class="col-sm-2 am-form-label" for="c_address" >俱乐部地址</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="c_address" placeholder="上课地址" name="c_address" required>
    </div>
  </div>



<div class="form-group">
    <label  class="col-sm-2 am-form-label">俱乐部简介</label>
    <div class="col-sm-10">
       <textarea class="form-control" rows="3" name="c_intro" required></textarea>
      </div>
</div>

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <input type="submit" class="btn btn-default" value="添加">
     <input type="reset" class="btn btn-default" value="重置">
  </div>
  </div>
</form>       


        </p>
      </div>
      <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary">Save changes</button>
      </div>
    </div>  
</div>
</div>


<!-- 修改模态框 -->
     <div id="editmodal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-header">
        <h3 id="myModalLabel">修改俱乐部</h3>
      </div>
      <div class="modal-body">
        <p>
        <form class="am-form am-text-sm" method="post" action="{:url('update')}" enctype="multipart/form-data">
          <input type="hidden" name="c_id" id="cid_edit">

  <div class="form-group">
    <label  class="col-sm-2 am-form-label" for="c_name" >俱乐部名称</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="c_namea" placeholder="俱乐部名称" name="c_name" required>
    </div>
  </div>

  <div class="form-group">
    <label  class="col-sm-2 am-form-label" for="c_tel" >联系电话</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="c_tela" placeholder="联系电话" name="c_tel" required>
    </div>
  </div>

<div class="form-group">
    <label  class="col-sm-2 am-form-label" for="c_address" >俱乐部地址</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="c_addressa" placeholder="上课地址" name="c_address" required>
    </div>
  </div>



<div class="form-group">
    <label  class="col-sm-2 am-form-label">俱乐部简介</label>
    <div class="col-sm-10">
       <textarea class="form-control" rows="3" name="c_intro" id="c_introa" required></textarea>
      </div>
</div>

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <input type="submit" class="btn btn-default" value="修改">
     <input type="reset" class="btn btn-default" value="重置">
  </div>
  </div>
</form>       


        </p>
      </div>
      <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary">Save changes</button>
      </div>
    </div>  
</div>
</div>



</div><!-- 3 -->
</div><!-- 2 -->
		</div><!-- 1 -->

<script>
      function jsedit(c_id) {
              //根据TID到数据库里把数据查询到显示在表单控件中
              $.getJSON("{:url('edit')}",{"c_id":c_id},
                  function(json) {
                      //alert(json.intro);
                      $("#cid_edit").val(json.c_id);
                      $("#c_ida").val(json.c_id);
                      $("#c_namea").val(json.c_name);
                      $("#c_tela").val(json.c_tel);
                      $("#c_introa").val(json.c_intro);
                      /*$("#cc_namea option[value="+json.cc_id+"]").attr("selected","selected");
                      $("#cv_namea option[value="+json.cv_id+"]").attr("selected","selected");*/
                      $("#c_addressa").val(json.c_address);
                  });
          }
    </script>	

{include file="public:footer"/}